Skip to content

Conversation

@jaclync
Copy link
Contributor

@jaclync jaclync commented Aug 1, 2025

For WOOMOB-957

Just one review is required.

Description

Fixes iPhone UI test failure test_create_new_order in the customer details address form, where the shipping first name field tap was failing. The issue occurred because:

  1. After introducing a CTA in the address form above the address fields in [HACK Week] Add map-based address picker for order details shipping address #15958, the CTA pushes down the address switch to edit shipping address. On iPhone's smaller screen, this results in the address switch not being toggled
  2. Therefore, the shipping address fields aren't shown and the shipping first name cannot be tapped
Screenshot 2025-08-01 at 3 29 49 PM

I can reproduce the failure locally. The same test case passes on iPad consistently in trunk. The UI test is not able to interact with elements covered by the keyboard.

Fix

After trying a few different ways to wait for the element and swipe up the view before toggling the switch, what worked is to add a \n to the billing address first name input so that the keyboard is dismissed. This allows the switch to be tappable.

Steps to reproduce

  1. Run the order creation UI test test_create_new_order on iPhone 16 iOS 18.5 simulator following the README -> the test should not fail when trying to tap the shipping first name field after enabling the address toggle. Locally, it failed on a separate screen when editing the order shipping amount but this is unrelated to the address picker change.

Testing information

UI tests passed on CI for both iPhone and iPad. The first run of the iPhone UI tests hung after the last test completed, I canceled and retried and it passed.


  • I have considered if this change warrants user-facing release notes and have added them to RELEASE-NOTES.txt if necessary.

jaclync added 2 commits August 1, 2025 15:19
…wn the address toggle by dismissing the keyboard with `\n` in the text field.
@jaclync jaclync added type: task An internally driven task. category: ui tests Related to UI testing. labels Aug 1, 2025
@jaclync jaclync added this to the 23.0 milestone Aug 1, 2025
@wpmobilebot
Copy link
Collaborator

wpmobilebot commented Aug 1, 2025

App Icon📲 You can test the changes from this Pull Request in WooCommerce iOS Prototype by scanning the QR code below to install the corresponding build.

App NameWooCommerce iOS Prototype
Build Numberpr15969-b432a68
Version22.9
Bundle IDcom.automattic.alpha.woocommerce
Commitb432a68
Installation URL5pe828gb3hie8
Automatticians: You can use our internal self-serve MC tool to give yourself access to those builds if needed.

@jaclync jaclync requested a review from Copilot August 1, 2025 08:14
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes an iPhone UI test failure in the customer details address form where the shipping first name field tap was failing due to the keyboard obscuring the address toggle switch on smaller screens.

  • Adds \n to dismiss the keyboard after entering billing first name
  • Adds table view swipe gestures to ensure proper visibility of UI elements
  • Specifically targets the test_create_new_order UI test failure on iPhone simulators

Comment on lines 47 to +48
addressToggleSet(to: "1")
tableView.swipeUp()

This comment was marked as off-topic.

Comment on lines +43 to +44
// `\n` was added after the first name input in order to dismiss the keyboard so that the address toggle is interactive in shorter screens.
billingFirstNameField.typeText("\(name)\n")
Copy link

Copilot AI Aug 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using \n to dismiss the keyboard is a workaround that may not be reliable across different iOS versions or keyboard configurations. Consider using a more explicit keyboard dismissal method such as tapping a done button or using app.keyboards.buttons["Done"].tap() if available.

Suggested change
// `\n` was added after the first name input in order to dismiss the keyboard so that the address toggle is interactive in shorter screens.
billingFirstNameField.typeText("\(name)\n")
// Tap the done button to dismiss the keyboard after entering the first name.
billingFirstNameField.typeText(name)
doneButton.tap()

Copilot uses AI. Check for mistakes.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Done" can be unreliable as well, as the OS can change the keyboard return button in future iOS versions.

@jaclync jaclync changed the title Fix iPhone UI test failure in customer details address form Fix iPhone UI test failure in trunk from customer details address form Aug 1, 2025
@jaclync jaclync requested review from iamgabrielma and staskus August 1, 2025 08:27
@iamgabrielma iamgabrielma self-assigned this Aug 1, 2025
Copy link
Contributor

@iamgabrielma iamgabrielma left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the quick fix! Test pass ✅

Locally, it failed on a separate screen when editing the order shipping amount but this is unrelated to the address picker change.

Yes, I'm seeing this as well, seems to happen in iPad only due to failing to focus on the textfield to write the amount, or similar. Interestingly it seems to pass in CI ¯_(ツ)_/¯

@jaclync
Copy link
Contributor Author

jaclync commented Aug 1, 2025

Thanks for reporting and testing! The separate local failure for me was on iPhone 16 iOS 18.5 simulator which is the same device type as on CI, but it passed consistently on CI 🤔

@jaclync jaclync merged commit b7e236f into trunk Aug 1, 2025
14 checks passed
@jaclync jaclync deleted the fix/WOOMOB-957-ui-test-failure-address-form branch August 1, 2025 09:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

category: ui tests Related to UI testing. type: task An internally driven task.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants